import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { ParkTicketUseVO, ParkTicketUseForm, ParkTicketUseQuery } from '@/api/park/parkTicketUse/types';

/**
 * 查询核销劵使用记录列表
 * @param query
 * @returns {*}
 */

export const listParkTicketUse = (query?: ParkTicketUseQuery): AxiosPromise<ParkTicketUseVO[]> => {
  return request({
    url: '/park/parkTicketUse/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询核销劵使用记录详细
 * @param ticketUseId
 */
export const getParkTicketUse = (ticketUseId: string | number): AxiosPromise<ParkTicketUseVO> => {
  return request({
    url: '/park/parkTicketUse/' + ticketUseId,
    method: 'get'
  });
};

/**
 * 新增核销劵使用记录
 * @param data
 */
export const addParkTicketUse = (data: ParkTicketUseForm) => {
  return request({
    url: '/park/parkTicketUse',
    method: 'post',
    data: data
  });
};

/**
 * 修改核销劵使用记录
 * @param data
 */
export const updateParkTicketUse = (data: ParkTicketUseForm) => {
  return request({
    url: '/park/parkTicketUse',
    method: 'put',
    data: data
  });
};

/**
 * 删除核销劵使用记录
 * @param ticketUseId
 */
export const delParkTicketUse = (ticketUseId: string | number | Array<string | number>) => {
  return request({
    url: '/park/parkTicketUse/' + ticketUseId,
    method: 'delete'
  });
};
